#include "UiSetSwitchWnd.h"
#ifdef MERGER_APP_TO_SHELL
	extern HINSTANCE g_SDHResModuleHandle;
#endif
UiSetSwitchWnd::UiSetSwitchWnd()
{
}

UiSetSwitchWnd::~UiSetSwitchWnd()
{
}

BOOL UiSetSwitchWnd::InitUiWin(void)
{
	BOOL bRtn = FALSE;
	LoadiInterItem();
	return bRtn;
}

void UiSetSwitchWnd::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate)
{
	m_SwitchWndBG->Draw(hdc, prcWin, false, false);
}

int UiSetSwitchWnd::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonDown(fwKeys, xPos, yPos);

}

int UiSetSwitchWnd::OnLButtonUp(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonUp(fwKeys, xPos, yPos);

}

void UiSetSwitchWnd::LoadiInterItem()
{
//jdhuang 20120818
	
#ifndef MERGER_APP_TO_SHELL
	m_SwitchWndBG = ImagingHelper::GetImageObject(MzGetInstanceHandle(), 1058);
#else
	m_SwitchWndBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 3058);
#endif
	RECT rtBtnCtrlWnd[MAX_SET_SWITCH_WND_BTN] = 
	{
		40, 15, 134, 109,
		100, 115, 194, 209,
		100, 215, 194, 309,
		40, 315, 134, 409,
	};
	
	m_BtnSwitchWnd[SWITCH_SET_WND_DISPLAY].SetPos(rtBtnCtrlWnd[SWITCH_SET_WND_DISPLAY].left, rtBtnCtrlWnd[SWITCH_SET_WND_DISPLAY].top,
					rtBtnCtrlWnd[SWITCH_SET_WND_DISPLAY].right-rtBtnCtrlWnd[SWITCH_SET_WND_DISPLAY].left,
					rtBtnCtrlWnd[SWITCH_SET_WND_DISPLAY].bottom-rtBtnCtrlWnd[SWITCH_SET_WND_DISPLAY].top);
	m_BtnSwitchWnd[SWITCH_SET_WND_DISPLAY].SetID(5100);
#ifndef MERGER_APP_TO_SHELL
	m_BtnSwitchWnd[SWITCH_SET_WND_DISPLAY].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1002, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_DISPLAY].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1003, true));
#else
	m_BtnSwitchWnd[SWITCH_SET_WND_DISPLAY].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3002, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_DISPLAY].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3003, true));
#endif
	AddChild(&m_BtnSwitchWnd[SWITCH_SET_WND_DISPLAY]);

	m_BtnSwitchWnd[SWITCH_SET_WND_CONTROL].SetPos(rtBtnCtrlWnd[SWITCH_SET_WND_CONTROL].left, rtBtnCtrlWnd[SWITCH_SET_WND_CONTROL].top,
					rtBtnCtrlWnd[SWITCH_SET_WND_CONTROL].right-rtBtnCtrlWnd[SWITCH_SET_WND_CONTROL].left,
					rtBtnCtrlWnd[SWITCH_SET_WND_CONTROL].bottom-rtBtnCtrlWnd[SWITCH_SET_WND_CONTROL].top);
	m_BtnSwitchWnd[SWITCH_SET_WND_CONTROL].SetID(5101);
#ifndef MERGER_APP_TO_SHELL
	m_BtnSwitchWnd[SWITCH_SET_WND_CONTROL].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1004, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_CONTROL].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1005, true));
#else
	m_BtnSwitchWnd[SWITCH_SET_WND_CONTROL].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3004, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_CONTROL].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3005, true));
#endif
	AddChild(&m_BtnSwitchWnd[SWITCH_SET_WND_CONTROL]);

	m_BtnSwitchWnd[SWITCH_SET_WND_COMMON].SetPos(rtBtnCtrlWnd[SWITCH_SET_WND_COMMON].left, rtBtnCtrlWnd[SWITCH_SET_WND_COMMON].top,
					rtBtnCtrlWnd[SWITCH_SET_WND_COMMON].right-rtBtnCtrlWnd[SWITCH_SET_WND_COMMON].left,
					rtBtnCtrlWnd[SWITCH_SET_WND_COMMON].bottom-rtBtnCtrlWnd[SWITCH_SET_WND_COMMON].top);
	m_BtnSwitchWnd[SWITCH_SET_WND_COMMON].SetID(5102);
#ifndef MERGER_APP_TO_SHELL
	m_BtnSwitchWnd[SWITCH_SET_WND_COMMON].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1006, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_COMMON].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1007, true));
#else
	m_BtnSwitchWnd[SWITCH_SET_WND_COMMON].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3006, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_COMMON].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3007, true));
#endif
	AddChild(&m_BtnSwitchWnd[SWITCH_SET_WND_COMMON]);

	m_BtnSwitchWnd[SWITCH_SET_WND_SYSTEM].SetPos(rtBtnCtrlWnd[SWITCH_SET_WND_SYSTEM].left, rtBtnCtrlWnd[SWITCH_SET_WND_SYSTEM].top,
					rtBtnCtrlWnd[SWITCH_SET_WND_SYSTEM].right-rtBtnCtrlWnd[SWITCH_SET_WND_SYSTEM].left,
					rtBtnCtrlWnd[SWITCH_SET_WND_SYSTEM].bottom-rtBtnCtrlWnd[SWITCH_SET_WND_SYSTEM].top);
	m_BtnSwitchWnd[SWITCH_SET_WND_SYSTEM].SetID(5103);
#ifndef MERGER_APP_TO_SHELL
	m_BtnSwitchWnd[SWITCH_SET_WND_SYSTEM].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1008, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_SYSTEM].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1009, true));
#else
	m_BtnSwitchWnd[SWITCH_SET_WND_SYSTEM].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3008, true));
	m_BtnSwitchWnd[SWITCH_SET_WND_SYSTEM].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,3009, true));
#endif
	AddChild(&m_BtnSwitchWnd[SWITCH_SET_WND_SYSTEM]);

}

BOOL UiSetSwitchWnd::InitImages()
{
	return TRUE;
}
void UiSetSwitchWnd::DeleteImages()
{
	m_SwitchWndBG->UnloadImage();
}